#!/usr/bin/env python3  
#coding:utf-8

import pytest
import os
import sys

def pytest_configure(config):
    jakaapp_dir = "src/zuc/usr_intf/JAKAAPP"
    rootdir = str(config.rootdir)
    jakaapp_full_path = os.path.join(rootdir, jakaapp_dir)
    if not os.path.exists(jakaapp_full_path):
        pytest.exit("Error: 在 %s 找不到 %s, 尝试切换到根目录运行" % (rootdir, jakaapp_dir), returncode=1)

    debug_dir_path = "Debug/bin"
    debug_full_path = os.path.join(rootdir, debug_dir_path)
    if not os.path.exists(debug_full_path):
        pytest.exit("Error:在 %s 找不到 %s, 尝试切换到根目录运行" % (rootdir, debug_dir_path), returncode=1)
    
    # TODO: 或许应该加在task.json
    sys.path.append(debug_full_path)
    sys.path.append(jakaapp_full_path)